/*
 * Project Beknyou
 * Copyright (c) 2010-2011 Saint Paul College, All Rights Reserved
 * Redistributions in source code form must reproduce the above
 * Copyright and this condition.
 * The contents of this file are subject to the GNU General Public
 * License, Version 2 (the "License"); you may not use this file
 * except in compliance with the License. A copy of the License is
 * available at http://www.opensource.org/licenses/gpl-license.php.
 */
package com.benkyou.util;

import com.benkyou.client.network.Chatter;
import com.benkyou.common.Player;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
/**
 *
 * @author Austin Allman
 */
public class UserListModel extends DefaultListModel implements ListSelectionListener{
      private JList userList;
      public void addJListListener(JList userList){
          this.userList = userList;
          
      }
    public void addUser(Chatter chatter){
        int index = userList.getSelectedIndex();
        index++;
        addElement(chatter);
        userList.setSelectedIndex(index);
        userList.ensureIndexIsVisible(index);
    }

    public void valueChanged(ListSelectionEvent e) {
        
    }

    
}